package cn.groupmarket.test.logicLink.model2.factory;

import cn.groupmarket.api.response.Response;
import cn.groupmarket.test.logicLink.model2.node.Node01;
import cn.groupmarket.test.logicLink.model2.node.Node02;
import cn.groupmarket.types.design.framework.link.model2.LinkArmory;
import cn.groupmarket.types.design.framework.link.model2.chain.BusinessLinkedList;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

@Service
public class Rule02TradeRuleFactory {

    @Bean("demo01")
    public BusinessLinkedList<String,DynamicContext, Response<String>> demo01(Node01 node01, Node02 node02){
        LinkArmory<String,DynamicContext,Response<String>> linkArmory = new LinkArmory<>("demo01",node01,node02);
        return linkArmory.getLogicLink();
    }

    @Bean("demo02")
    public BusinessLinkedList<String,DynamicContext, Response<String>> demo02(Node01 node01, Node02 node02){
        LinkArmory<String,DynamicContext,Response<String>> linkArmory = new LinkArmory<>("demo02",node01,node01,node01,node02);
        return linkArmory.getLogicLink();
    }

    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    public static class DynamicContext{
        private String age;
    }

}
